require 'rubygems'
require 'gruff'

class TestController < ApplicationController
  layout "books"
  
  def index
    flash[:error]  = "KO"
    flash[:warning]  = "Attention"
    flash[:notice]  = "Ok"
    
    @book = Book.find("3")
  end
  
  def graphe
    g = Gruff::Line.new
    g.title = 'Mon graphe'
    
    g.data('Pommes', [10, 30, 60, 4, 6])
    g.data('Poires', [6, 3, 6, 8, 1])
    g.data('Oranges', [10, 14, 3, 7])
    
    g.labels = { 0 => "2006", 1 => "2007", 2 => '2008'}
    
    g.write("#{RAILS_ROOT}/public/images/monGraphe.png")
  end
end
